package ex4;

/**
 * @author: knowno
 * @create: 2024-09-06 14:09
 * @Version 1.0
 *
 * 1.  implements  Cloneable
 * 2. protected Object clone() 重写
 **/
public class Girl implements  Cloneable {
    private String name;
    private int age;

    @Override
    public String toString() {
        return "Girl{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                '}';
    }

    public Girl() {
    }

    public Girl(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
